#SRC=ggg.f90 estmod.f90 fereg.f90 ff.f90 gg.f90 dplog.f90 logprob.f invert.f opt.f phi.f merror.f phisig.f phisigd.f

fpath=../bpfcodes_com

SRC= $(fpath)/nr/nrtype.f90 \
     $(fpath)/nr/nr.f90 \
     $(fpath)/Fcodes/nrutil.f90 \
     $(fpath)/Fcodes/invert.f90 \
     $(fpath)/Fcodes/isort.f90 \
     $(fpath)/Fcodes/matrix.f90 \
     $(fpath)/Fcodes/interpol.f90 \
     $(fpath)/Fcodes/integration.f90 \
     $(fpath)/nr/nrutil0.f90 \
     $(fpath)/nr/tridag.f90 \
     $(fpath)/nr/zbrent.f90 \
     $(fpath)/nr/mnbrak.f90 \
     $(fpath)/nr/gammln.f90 \
     $(fpath)/nr/factln.f90 \
     $(fpath)/nr/bico.f90 \
     $(fpath)/nr/sort.f90 \
     $(fpath)/Fcodes/comf_trans.f90 \
     $(fpath)/Fcodes/rouwenhorst.f90 \
     $(fpath)/Fcodes/random.f90 \
     $(fpath)/Fcodes/statistics.f90 \
     $(fpath)/Fcodes/probability.f90 \
     $(fpath)/Fcodes/minimization.f90 \
     $(fpath)/Fcodes/simplex.f90 \
     $(fpath)/Fcodes/simplexC.f90 \
     $(fpath)/Fcodes/simplexB.f90 \
     $(fpath)/Fcodes/mod_subplx.f90 \
     $(fpath)/Fcodes/mod_newuoa_module.f90 \
     $(fpath)/Lbfgsb/timer.f90 \
     $(fpath)/Lbfgsb/blas.f90 \
     $(fpath)/Lbfgsb/linpack.f90 \
     $(fpath)/Lbfgsb/lbfgsb.f90 \
     $(fpath)/globvar.f90 \
     $(fpath)/comfuncs.f90 \
     $(fpath)/init.f90 \
     $(fpath)/debugprint.f90 \
     $(fpath)/cmaxee.f90 \
     $(fpath)/distance.f90 \
     $(fpath)/gmmse.f90 \
     main.f90

OBJ=$(SRC:.f=.o)

#F77=gfortran  -fbounds-check
#F77=/opt/intel_fc_80/bin/ifort -w -C
#F77=/opt/intel_fc_80/bin/ifort -w -O3
#F77=/opt/intel/fc/10.1.015/bin/ifort -w -O3
#F77=gfortran -O3 -Wall -Wextra -Wconversion -fbounds-check
#F77=ifort -w -O3
#F77=ifort -W0 -C

F90=f90 -m0 -Ofast -N113 -Rc -Rb
F95=f95

#F77=gfotran

F77=gfortran44

#fcompile=mpif90 -mcmodel=medium -i-dynamic -i8
#FCARGU=-Wl,-rpath,$INTEL_LIB_PATH

#COPTS= -fp-model precise #it works
#COPTS=	-g #debug info

#.f.o:
#	$(fcompile) -c $(COPTS) $<

## Fortran mpifort (for v1.7 and above)
##         mpif77 and mpif90 (for older versions)
fcompile=mpifort
#fcompile=mpif90
#fcompile=mpif77
#fcompile=mpicc
#fcompile=gfortran
FCARGU= -O2

bpfmpi_het.exe: $(OBJ)
	$(fcompile) $(OBJ) $(FCARGU) -o $@        

clean: rm *.mod

#	rm -rf *.mod
#	$(F95) $(SRC)   -o  estmodfan.out
#
#The -mcmodel flag selects the memory model 
# or memory access modes for a program. 
# Three memory models are supported by the compilers: 
#        small (text+data<2GB), 
#        medium (text<2GB, data>2GB), and 
#        large (text>2GB, data>2GB). 
# Memory segments less than 2GB can be accessed 
# with direct references, while larger segments 
# require indirect or relative references.
